#pragma once

#include <cstdint>

namespace stream {
namespace meta {

class Size {
	static Size __size;
public:
	static Size & empty(){
		return __size;
	}
	Size(uint64_t v = 0) 
	: _v(v)
	{
	}
	virtual ~Size(){}

	//load from persist
	virtual bool load();

	//store to persist
	virtual bool store();

	//only memory
	inline uint64_t get() const{
		return _v;
	}

	//only memory
	inline void set(uint64_t sz){
		_v = sz;
	}

	//return old_v
	inline uint64_t inc(uint64_t step = 1){
		uint64_t old = _v;
		_v += step;
		return old;
	}

	//return old_v
	inline uint64_t dec(uint64_t step = 1){
		uint64_t old = _v;
		_v -= step;
		return old;
	}
private:
	uint64_t _v;
};

}//end namespace meta
}//end namespace stream

